package com.ruoyi.wmsorder.quartz.config;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzSerialNumberConfig {

    @Bean
    public JobDetail  jobDetail(){
     return    JobBuilder.newJob(SerialNumberJob.class)
                .storeDurably()
                .build();
    }
    //corn表达式
    String c="0 0 0 * * ?";  //每隔二十秒执行一次
    @Bean
    public Trigger  trigger(){
        return TriggerBuilder.newTrigger()
              .forJob(jobDetail())
                .withSchedule(CronScheduleBuilder.cronSchedule(c))
                .build();
    }
}
